package com.example.jvm.jvm03.lesson12;

import lombok.extern.slf4j.Slf4j;

import java.lang.management.ManagementFactory;
import java.lang.management.OperatingSystemMXBean;

/**
 * @Description
 * @Date 2021/7/8
 * @Created by Jonathan
 */
@Slf4j
public class Demo01 {
    public static void main(String[] args) {
        while (true) {
            int byteToMb = 1024 * 1024;
            long l = Runtime.getRuntime().totalMemory() / byteToMb;
            long l1 = Runtime.getRuntime().maxMemory() / byteToMb;
            log.info("-Xms:{}M", l);
            log.info("-Xmx:{}M", l1);
            OperatingSystemMXBean operatingSystemMXBean = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();
            String arch = operatingSystemMXBean.getArch();
            log.info("arch:{}", arch);
        }
    }
}
